/**
 * 主页
 */
import LoginPage from "@/views/LoginPage.vue";
/**
 *
 */
import HomePage from "@/views/HomePage.vue";
/**
 *
 */
import {
    HOME_URL,
    LOGIN_URL,
    INSPECTOR_URL,
    DATA_SERVICE_URL,
    DATA_MANAGE_URL,
    DATA_CATALOGUE_URL,
    DATA_PICTURE_URL,
} from "@/common/names";
/**
 *
 */
import {
    Box,
    DataBoard,
    DataAnalysis,
    DataLine,
} from "@element-plus/icons-vue";

// 公共路由
export const asideRoutes = [
    {
        path: "/inspectors",
        name: INSPECTOR_URL,
        meta: {
            label: "平台概览",
            icon: Box,
            noAuth: true,
        },
        component: () => import("@/views/Inspectors.vue"),
    },
    {
        path: "/dataService",
        name: DATA_SERVICE_URL,
        meta: {
            label: "云数据服务",
            icon: DataBoard,
        },
        children: [

            {
                path: "/data_manage",
                name: DATA_MANAGE_URL,
                meta: {
                    label: "数据集管理",
                    icon: DataAnalysis,
                    certificate: true,
                },
                component: () => import("@/views/data/DataManage.vue"),
            },


            {
                path: "/data_catalogue",
                name: DATA_CATALOGUE_URL,
                meta: {
                    label: "目录管理",
                    certificate: true,
                },
                component: () => import("@/views/data/DataCatalogue.vue"),
            },


            {
                path: "/data_picture",
                name: DATA_PICTURE_URL,
                meta: {
                    label: "图片管理",
                    icon: Box,
                    certificate: true,
                },
                component: () => import("@/views/data/DataPicture.vue"),
            },



        ]

    },



];

export const routes = [
    {
        path: "/",
        redirect: () => {
            return INSPECTOR_URL;
        },
    },

    {
        path: "/login",
        name: LOGIN_URL,
        component: () => import("@/views/LoginPage.vue"),
        meta: {
            title: "登录",
        },
    },

    {
        path: "/home",
        name: HOME_URL,
        component: () => import("@/views/HomePage.vue"),
        meta: {
            title: "首页",
        },
        children: [...asideRoutes],
    },

    // 匹配不存在路由
    {
        path: "/:pathMatch(.*)*",
        redirect: (to) => {
            return {
                name: INSPECTOR_URL,
            };
        },
    },
];
